package com.zys.hotel_management.service.impl;

import com.zys.hotel_management.entity.Admin;
import com.zys.hotel_management.mapper.AdminMapper;
import com.zys.hotel_management.service.AdminService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @Author:Soyo
 * @Description:
 * @Create: 2025/5/23
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Resource
    private AdminMapper adminMapper;
    @Override
    public Admin login(String username, String password) {
        Admin admin = adminMapper.findByUsername(username);
        if (admin == null || !admin.getPassword().equals(password)){
            return null;
        }
        return admin;
    }

    @Override
    public Admin getByUsername(String username) {
        return adminMapper.findByUsername(username);
    }
}
